home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2000 September / maximum-cd-2000-09.iso / Vampire the Masquerade / vampire_demo.exe / Codex.nob / MultiPivotDoor.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-06-22  |  4.0 KB  |  150 lines

  1. public class MultiPivotDoor extends Codex {
  2.    private int _frameNum = 1;
  3.    private float _duration = 3.0F;
  4.    private CodexThing _door = new CodexThing(((Codex)this).GetClassThing());
  5.    private CodexThing _door2;
  6.    private CodexThing _door3;
  7.    private CodexThing _door4;
  8.    private CodexThing _door5;
  9.    private CodexThing _door6;
  10.    private CodexThing _door7;
  11.    private CodexThing _door8;
  12.    private int _OpenOnce;
  13.    private int _AllowClicked = 1;
  14.    private boolean bOpen;
  15.    private boolean bActive;
  16.    public static String[] _params = new String[]{"Rotate around frame;1", "Duration;3.0", "Open Once;0", "Allow clicked event; 1", "Second part of door", "Third part of door", "Fourth part of door", "Fifth part of door", "Sixth part of door", "Seventh part of door", "Eighth part of door"};
  17.  
  18.    public void clicked(int guid, int clickerGuid, int captureId) {
  19.       if (this._AllowClicked == 1) {
  20.          this.MoveParts();
  21.       }
  22.  
  23.    }
  24.  
  25.    public void beginscene(int clientGuid, int captureID) {
  26.       this._door.SetThingFlags(8192);
  27.       this._door2.SetThingFlags(8192);
  28.       this._door3.SetThingFlags(8192);
  29.       this._door4.SetThingFlags(8192);
  30.       this._door5.SetThingFlags(8192);
  31.       this._door6.SetThingFlags(8192);
  32.       this._door7.SetThingFlags(8192);
  33.       this._door8.SetThingFlags(8192);
  34.    }
  35.  
  36.    public void arrived(int thingGuid, int frameNum, int captureId) {
  37.       if (this._OpenOnce == 0) {
  38.          this.bActive = false;
  39.       } else {
  40.          this._door.SetCollideType(0);
  41.          this._door2.SetCollideType(0);
  42.          this._door3.SetCollideType(0);
  43.          this._door4.SetCollideType(0);
  44.          this._door5.SetCollideType(0);
  45.          this._door6.SetCollideType(0);
  46.          this._door7.SetCollideType(0);
  47.          this._door8.SetCollideType(0);
  48.          this._door.SetThingFlags(64);
  49.          this._door2.SetThingFlags(64);
  50.          this._door3.SetThingFlags(64);
  51.          this._door4.SetThingFlags(64);
  52.          this._door5.SetThingFlags(64);
  53.          this._door6.SetThingFlags(64);
  54.          this._door7.SetThingFlags(64);
  55.          this._door8.SetThingFlags(64);
  56.       }
  57.  
  58.    }
  59.  
  60.    public void restore(int flags) {
  61.       this.bOpen = CodexSequence.RestoreBoolean();
  62.    }
  63.  
  64.    public void MoveParts() {
  65.       if (!this.bActive) {
  66.          this.bActive = true;
  67.          if (!this.bOpen) {
  68.             this._door.RotatePivot(this._frameNum, this._duration);
  69.             this._door2.RotatePivot(this._frameNum, this._duration);
  70.             this._door3.RotatePivot(this._frameNum, this._duration);
  71.             this._door4.RotatePivot(this._frameNum, this._duration);
  72.             this._door5.RotatePivot(this._frameNum, this._duration);
  73.             this._door6.RotatePivot(this._frameNum, this._duration);
  74.             this._door7.RotatePivot(this._frameNum, this._duration);
  75.             this._door8.RotatePivot(this._frameNum, this._duration);
  76.             this.bOpen = true;
  77.          } else {
  78.             this._door.RotatePivot(this._frameNum, -this._duration);
  79.             this._door2.RotatePivot(this._frameNum, -this._duration);
  80.             this._door3.RotatePivot(this._frameNum, -this._duration);
  81.             this._door4.RotatePivot(this._frameNum, -this._duration);
  82.             this._door5.RotatePivot(this._frameNum, -this._duration);
  83.             this._door6.RotatePivot(this._frameNum, -this._duration);
  84.             this._door7.RotatePivot(this._frameNum, -this._duration);
  85.             this._door8.RotatePivot(this._frameNum, -this._duration);
  86.             this.bOpen = false;
  87.          }
  88.  
  89.       }
  90.    }
  91.  
  92.    public void triggered(int triggeredGUID, int triggererGUID, int triggerID, float p0, float p1, float p2, float p3, int captureID) {
  93.       this.MoveParts();
  94.    }
  95.  
  96.    public MultiPivotDoor(int frameNum, float duration, int OpenOnce, int AllowClicked, CodexThing door2, CodexThing door3, CodexThing door4, CodexThing door5, CodexThing door6, CodexThing door7, CodexThing door8) {
  97.       this._door.SetDescriptionID("GEN_DOOR");
  98.       this._frameNum = frameNum;
  99.       this._duration = duration;
  100.       this._OpenOnce = OpenOnce;
  101.       this._AllowClicked = AllowClicked;
  102.       this._door2 = new CodexThing(((Codex)door2).GetGUID());
  103.       if (this._door2.GetDescriptionID().equalsIgnoreCase("PROP")) {
  104.          this._door2.SetDescriptionID("GEN_DOOR");
  105.       }
  106.  
  107.       ((Codex)this).CaptureThing(this._door2.GetGUID());
  108.       this._door3 = new CodexThing(((Codex)door3).GetGUID());
  109.       if (this._door3.GetDescriptionID().equalsIgnoreCase("PROP")) {
  110.          this._door3.SetDescriptionID("GEN_DOOR");
  111.       }
  112.  
  113.       ((Codex)this).CaptureThing(this._door3.GetGUID());
  114.       this._door4 = new CodexThing(((Codex)door4).GetGUID());
  115.       if (this._door4.GetDescriptionID().equalsIgnoreCase("PROP")) {
  116.          this._door4.SetDescriptionID("GEN_DOOR");
  117.       }
  118.  
  119.       ((Codex)this).CaptureThing(this._door4.GetGUID());
  120.       this._door5 = new CodexThing(((Codex)door5).GetGUID());
  121.       if (this._door5.GetDescriptionID().equalsIgnoreCase("PROP")) {
  122.          this._door5.SetDescriptionID("GEN_DOOR");
  123.       }
  124.  
  125.       ((Codex)this).CaptureThing(this._door5.GetGUID());
  126.       this._door6 = new CodexThing(((Codex)door6).GetGUID());
  127.       if (this._door6.GetDescriptionID().equalsIgnoreCase("PROP")) {
  128.          this._door6.SetDescriptionID("GEN_DOOR");
  129.       }
  130.  
  131.       ((Codex)this).CaptureThing(this._door6.GetGUID());
  132.       this._door7 = new CodexThing(((Codex)door7).GetGUID());
  133.       if (this._door7.GetDescriptionID().equalsIgnoreCase("PROP")) {
  134.          this._door7.SetDescriptionID("GEN_DOOR");
  135.       }
  136.  
  137.       ((Codex)this).CaptureThing(this._door7.GetGUID());
  138.       this._door8 = new CodexThing(((Codex)door8).GetGUID());
  139.       if (this._door8.GetDescriptionID().equalsIgnoreCase("PROP")) {
  140.          this._door8.SetDescriptionID("GEN_DOOR");
  141.       }
  142.  
  143.       ((Codex)this).CaptureThing(this._door8.GetGUID());
  144.    }
  145.  
  146.    public void save(int flags) {
  147.       CodexSequence.SaveBoolean(this.bOpen);
  148.    }
  149. }
  150.